package org.platform.processor.diagnose.tree.impl;


import org.platform.mo.db.FdDiagnoseTaskTreeNode;
import org.platform.processor.diagnose.DiagnoseTaskProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 测试诊断
 * <p>
 * 发起测试申请
 * 1.更具知识id和可用的模板id查询出对应的参数
 * 2.替换参数中的设备链路和测试参数
 * 3.将新的参数保存到诊断模块下的测试部分
 * <p>
 * 1.从新创建诊断任务
 * 2.让任务调度线程去从新执行
 * 3.执行测试申请流程
 * 4.定时去获取本次测试申请的结果
 * 5.返回当前结果
 *
 * @author FengJie
 * @date 2018/8/1
 */
@Service
public class TestFaultTreeNodeImpl extends AbstractFaultTreeNodeDiagnose {
    @Autowired
    private DiagnoseTaskProcessor processor;

    @Override
    public boolean doExecute(FdDiagnoseTaskTreeNode treeNode) {
        String subDiagnoseTaskId = processor.addSubTestDiagnoseByTreeNode(treeNode);
        return processor.getSubDiagnoseTaskResult(subDiagnoseTaskId, treeNode);
    }

}
